//
//  QuHuoViewController.m
//  Experss
//
//  Created by wmwMAC on 17/8/11.
//  Copyright © 2017年 嗯，大葱. All rights reserved.
//

#import "QuHuoViewController.h"

#import "QuHuoListTableViewCell2.h"
#import "QuHuoTileTableViewCell2.h"

#import "NoJieDanViewController.h"



static NSString *identifier = @"QuHuoListTableViewCell2";
static NSString *titleIdentifier = @"QuHuoTileTableViewCell2";

@interface QuHuoViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;

@end

@implementation QuHuoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"取货列表";
    self.navigationController.navigationBar.barTintColor = [UIColor whiteColor];
    
    [self addTableviewUI];
    
}
- (void)addTableviewUI {
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight) style:UITableViewStylePlain];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.rowHeight = 47 + (kScreen_Width - 40 - 30 - 40)/5.0 + 26+6 + 47 + 40 + 55 + 10;    self.tableView.backgroundColor = BaseColor;
    [self.tableView registerNib:[UINib nibWithNibName:@"QuHuoTileTableViewCell2" bundle:nil] forCellReuseIdentifier:titleIdentifier];
    [self.tableView registerClass:[QuHuoListTableViewCell2 class] forCellReuseIdentifier:identifier];
    [self.view addSubview:self.tableView];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    QuHuoListTableViewCell2 *cell = [tableView dequeueReusableCellWithIdentifier:identifier forIndexPath:indexPath];
    
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    
        return 80;
    
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    UIView *headerView = [[UIView alloc] init];
    headerView.backgroundColor = BaseColor;
    
    CGRect rect = CGRectMake(0, 0, kScreenWidth, 80);
    QuHuoTileTableViewCell2 *cell = [[UINib nibWithNibName:titleIdentifier bundle:nil] instantiateWithOwner:nil options:nil][0];
    
    
    cell.frame = rect;
    
    UIView * view = [[UIView alloc] initWithFrame:rect];
    
    [view addSubview:cell];
    
    [headerView addSubview:view];
    
    
    return headerView;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.001;
}

- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section {
    UIView *footview = [[UIView alloc] init];
    footview.backgroundColor = BaseColor;
    
    return footview;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    //立即接单
    NoJieDanViewController *vc = [[NoJieDanViewController alloc] init];
    vc.hidesBottomBarWhenPushed = YES;
    [self.navigationController pushViewController:vc animated:YES];
}

@end
